package io.github.wanggit.antrpc.client.zk.zknode;

import org.apache.zookeeper.CreateMode;

import java.util.List;

/** Zookeeper节点操作 */
public interface IZkNodeOperator {

    void remoteCreateZkNode(String zkFullpath, byte[] nodeData, CreateMode createMode);

    void deleteNode(String zookeeperFullPath);

    boolean existsNode(String fullPath);

    boolean existsData(String fullPath);

    void setNodeData(String fullPath, byte[] data);

    byte[] getData(String fullPath);

    List<String> getChildren(String path);

    void getDescendants(String path, Filter filter, List<String> descendants);

    interface Filter {
        default boolean accepted(String path) {
            return true;
        }
    }
}
